/**
 * @param {string} s
 * @return {number}
 */
 var minFlipsMonoIncr = function(s) {
  let r = s.split('').filter(e => e === '0').length;
  let l = 0;
  let ret = r;
  for(let i = 0; i < s.length; i++) {
      if(s[i] === '1') {
         l++;
      } else {
          r--;
      }
      ret = Math.min(l + r, ret);
  }
  return ret;
};